package com.aaa.doctor.controller.api;

import com.aaa.doctor.dto.RegPatDto;
import com.aaa.doctor.service.RegistrationServer;
import com.aaa.doctor.vo.RegistrationVo;
import com.aaa.entity.CareHistory;
import com.aaa.entity.Registration;
import com.aaa.vo.Result;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author MuChengGuo
 * @date 2023/3/26 18:18
 * Description: TODO
 **/
@Api(tags = "前端 - 门诊挂号&挂号列表")
@RestController
@RequestMapping("doctor/api/registration")
public class RegistrationApiController {
    @Autowired
    private RegistrationServer registrationServer;

    @PostMapping("regList/{current}/{size}")
    @ApiOperation(value = "条件查询挂号列表&分页")
    public Result<IPage<Registration>> getRegList(
            @ApiParam(value = "当前页码", required = true) @PathVariable Integer current,
            @ApiParam(value = "每页显示条数", required = true) @PathVariable Integer size,
            @ApiParam(value = "查询条件") @RequestBody RegistrationVo registrationVo
    ) {
        return registrationServer.getRegistrationList(current, size, registrationVo);
    }

    @ApiOperation(value = "通过 registrationId 修改挂号状态 - 收费")
    @GetMapping("getCollect/{registrationId}")
    public Result<String> getCollect(@PathVariable String registrationId) {
        return registrationServer.getCollect(registrationId);
    }

    @ApiOperation(value = "通过 registrationId 修改挂号状态 - 退号")
    @GetMapping("getReturn/{registrationId}")
    public Result<String> getReturn(@PathVariable String registrationId) {
        return registrationServer.getReturn(registrationId);
    }

    @ApiOperation(value = "通过 registrationId 修改挂号状态 - 作废")
    @GetMapping("getInvalid/{registrationId}")
    public Result<String> getInvalid(@PathVariable String registrationId) {
        return registrationServer.getInvalid(registrationId);
    }

    @ApiOperation(value = "查询待就诊的数据 ")
    @GetMapping("queryToBeSeenRegistration/{schedulingType}")
    public Result<List<Registration>> queryToBeSeenRegistration(@PathVariable String schedulingType) {
        return registrationServer.queryToBeSeenRegistration(schedulingType);
    }

    @ApiOperation(value = "查询就诊中的数据 ")
    @GetMapping("queryVisitingRegistration/{schedulingType}")
    public Result<List<Registration>> queryVisitingRegistration(@PathVariable String schedulingType) {
        return registrationServer.queryVisitingRegistration(schedulingType);
    }

    @ApiOperation(value = "查询待就诊的数据 ")
    @GetMapping("queryVisitCompletedRegistration/{schedulingType}")
    public Result<List<Registration>> queryVisitCompletedRegistration(@PathVariable String schedulingType) {
        return registrationServer.queryVisitCompletedRegistration(schedulingType);
    }

    @ApiOperation(value = "通过 registrationId 接诊此患者 ")
    @GetMapping("handleVisit/{registrationId}")
    public Result<List<Registration>> handleVisit(@PathVariable String registrationId) {
        return registrationServer.handleVisit(registrationId);
    }

    @ApiOperation(value = "门诊挂号 - 挂号收费")
    @PostMapping("addRegistration")
    public Result<String> addRegistration(@RequestBody RegPatDto regPatDto) {
        return registrationServer.addRegistration(regPatDto);
    }

    @ApiOperation(value = "挂号收费 ")
    @GetMapping("collectFee/{registrationId}")
    public Result<String> collectFee(@PathVariable String registrationId) {
        return registrationServer.collectFee(registrationId);
    }

    @ApiOperation(value = "通过 registrationId 修改挂号状态 - 作废")
    @GetMapping("visitComplete/{registrationId}")
    public Result<String> visitComplete(@PathVariable String registrationId) {
        return registrationServer.visitComplete(registrationId);
    }

    @ApiOperation(value = "查询排班就诊-当前号数")
    @GetMapping("getRegistrationNumber/{deptId}")
    public Result<Integer> getRegistrationNumber(@PathVariable Long deptId) {
        return registrationServer.getRegistrationNumber(deptId);
    }


    @ApiOperation(value = "根据挂号单ID查询对应的病历信息")
    @GetMapping("getCareHistoryByRegId/{regId}")
    public Result<CareHistory> getCareHistoryByRegId(@PathVariable String regId) {
        return registrationServer.getCareHistoryByRegId(regId);
    }

}
